home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
726-750
/
746
/
skew
/
skew.readme
< prev
next >
Wrap
Text File
|
1995-03-18
|
8KB
|
179 lines
WHAT IS THIS?
I wrote this program because:
1. I wanted to learn something about the new Amiga gadgetry (and
request'ry).
2. Nobody else did.
"Skew" (stands for "SKEleton Writer") is a tool for generating C code for
various Intuition based applications on the Amiga. You click the mouse and
the code gets written. There are already a couple of such programs -- Jan van
den Baard's "PowerSource" and "GadToolsBox" (this latter was, by the way,
intensively used by myself while writing this stuff here), Matt Dillon's
"TplEdit" etc. They generate code for screens, windows, gadgets, menues and
so on; being even capable of creating (with some your help) a wholly runnable
program. If so -- why would I need this stuff, you're asking?
Well -- Skew's domain is slightly different: it WON'T create a runnable
program by itself, but, for a cost of twenty or fifty mouse clicks, it CAN
save you typing some hundred lines of C code. More -- in most cases you would
be typing with only one finger holding some interesting but not very handy
book like the "Amiga ROM Kernel Reference Manual" with other hand...
All the (splendid!) programs I mentioned earlier WILL write you a complete
code you can compile and run; the resulting programs WILL have beautiful
gadgets, menues etc. but -- if you want to have a prrogram that DOES something
non-trivial -- you will still write the code for the IDCMP handling yourself
and merge it with the (machine-generated or not) code. Some typing is
involved here if your application is more or less sophisticated.
Enters "Skew" and what it does? "Skew" generates namely the function (named
by default) GetIDCMP() with the pertaining switch and cases for the various
Class'es in IntuiMessage; as well as some other related stuff. If one
consideres that there is 26 such classes now and they all have long, all-
uppercase names it might seem strange that nobody got the idea of any
automatization here...
------------------------------------------------------------------------
HOW TO?
When (if?) you start the program you see a screen with a couple of gadgets
and a logo. The purpose of the gadgets in the lowest row should be rather
obvious. In the string gadget you place the name of the IDCMPWindow (which
can be a requester) or you can leave the default name.
The other gadgets: the check-buttons with "Class", "Code", "Qualifier"
etc. written by them are the fields in IntuiMessage you are interesting in
reading. "Class" is pre-set because: firstly -- it is so often needed,
secondly -- you would not get much of this program if you do not want them.
However, even if you turn "Class" off, you will get this variable read by the
resulting code, if any of the flag values on the next 'screen' (backdrop
window actually) is set, and "Skew" sees that you will need it after all. So
wise it is -- sheer IA!! And you always will be able, of course, to return
whenever you wish to change the settings or merely see them.
Then you go to the second 'screen' with the groups of check-button gadgets in
groups of two, in addition to the big (and obvious) ones at the bottom. One of
such pair has i.e. "MOUSEBUTTONS" inscribed to its left, while the other has
"F". Now -- if you set ANY of them ON, you will get a case for MOUSEBUTTONS
in the generated switch, if you set this with "F" ON (no matter what is the
state of the other one!) -- you will get a function call in this case. It is
something like that:
without "F":
switch ( class ) {
... <--- earlier cases
case MOUSEBUTTONS:
<--- place for your code
break;
... <--- more cases
with "F":
switch ( class ) {
... <--- earlier cases
case MOUSEBUTTONS:
MouseButtons();
break;
... <--- more cases
Now, the MouseButtons() might be called something like
HandleMouseButtons123(); and you may even get its prototype (ANSI-style), as
well as a 'skeleton' -- see below.
Not so much, I agree, but always less typing (remember the one finger bit!).
and there is still (slightly...) more!!!
When we turn to the third 'screen' we can set some general options like:
1. The name for the GetIDCMP() function in case you do not like this
name, or, for example, need stuff like GetIDCMP1(), GetIDCMP2(), ...
GetIDCMP25(). A string gadget.
2. Prefix and suffix for the generated 'child functions' so that, for
instance, MouseButtons() becomes my_new_MouseButtons_turbo(). Two
string gadgets for that.
3. Whether you will want function prototypes. A cycle gadget.
4. If you will want function 'skeletons' in the form more or less like:
VOID MouseButtons()
{
}
or
MouseButtons()
{
}
, but it is possible to got EVEN MORE!!!. It is a cycle gadget.
5. Whether you will use the new gadtools.library -- if you will you
should have this set!
6. A cycle gadget with which you decide if you want to passively
wait for the messages, or maybe you will need to spin and do something
like i.e. printing a banner (or something much more ambitious) in the
meantime. The place the code for that should be placed will be marked
if you set the "comments" and/or "fill-ins" flag on.
7. A cycle gadget with which you decide if the variables should be local
or global. It might be much easier to use globals, but you know --
globals are 'impure' they say...
8. Do you want verbose comments, some comments or none at all? The
comments are really not very enlighting, and the difference between
"verbose" and "sparse" in not great. I simply got tired of inventing
them, you know...
9. Fill-ins -- also a cycle gadget. You decide whether you want the
places where you will have to put something marked with '@@',
'/* @@ */', '@@@@@@@@@@', or not marked at all. The idea is here that
should be easy to find the '@@' from an editor, but you might want
them commented-out if you are trying to compile an un-finished code.
The '@@@@@@@@@@' shoud be easy to spot with bare eye, if you for
instance want to see how much you will need to type yourself. Most of
the places to fill in will be marked, but not necessarily all -- if
you do something more with a function than only call it there WILL be
slightly more.
------------------------------------------------------------------------
SOME FINAL REMARKS:
"Skew" is not a hyper smart program: it will let you, for instance, type
stupid names in the string gadgets and do many other things like that; you
will be able to correct all this later, in your editor. The code generated is
in EXTREMELY LOOSE format that you might hate, I believe that it is easier to
see things this way. 2.0x. On the other hand, however, its 'pure'. It should
open on interlaced screen if you have NTSC. It is in Public Domain. "Skew" was
compiled with DICE 2.6 (registered version); much if not most of the code for
the screen, window & gadgets was generated by GadToolsBox; while the editor I
am always using (and love dearly) is UEdit now 3.0c (registered).
Piotr Obminski
Flogstavägen 43C:323
752 63 UPPSALA
SWEDEN
tel. 018-46 38 32